<script setup>
import { ref } from "vue";
import children from "./children.vue";

const money = ref(100);
const car = ref("黄金玛莎");
const changeMoney = (num) => {
    money.value = money.value - num
};
const changeCar = (name) => {
    car.value = name;
}
</script>

<template>
    <div>
        <h1>我是父组件</h1>
        <div>金钱: {{ money }}</div>
        <div>车辆: {{ car }}</div>
        <hr />
        <children :money="money" :car="car" @change-money="changeMoney" @change-car="changeCar" />
    </div>
</template>